﻿
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>新增轮播图</title>
    <link href="~/Areas/Back/lib/layui/css/layui.css" rel="stylesheet" />
    <script src="~/Areas/Back/lib/layui/layui.js"></script>
</head>
<body>
    <div class="layui-container" style="margin-top:50px;margin-bottom:150px">
        @*设计师名字*@
        <form class="layui-form" id="addFrom" onsubmit="return false">
            <div class="layui-form-item">
                <label class="layui-form-label">名字</label>
                <div class="layui-input-block">
                    <input type="text" id="Name" class="layui-input" placeholder="请输入名字" />
                </div>
            </div>
            @*电话*@
            <div class="layui-form-item">
                <label class="layui-form-label">电话</label>
                <div class="layui-input-block">
                    <input type="text" id="Tel" class="layui-input" placeholder="请输入电话" />
                </div>
            </div>
            @*邮箱*@
            <div class="layui-form-item">
                <label class="layui-form-label">邮箱</label>
                <div class="layui-input-block">
                    <input type="text" id="Email" class="layui-input" placeholder="请输入邮箱" />
                </div>
            </div>
            @*内容*@
            <div class="layui-form-item">
                <label class="layui-form-label">内容</label>
                <div class="layui-input-block">
                    <input type="text" id="Cont" class="layui-input" placeholder="请输入内容" />
                </div>
            </div>
            @*提交和重置按钮*@
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit lay-filter="subAdd">立即提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </form>
    </div>
</body>
<script>
    layui.use(['form', 'layedit', 'upload'], function () {
        var form = layui.form;
        var layedit = layui.layedit;
        var upload = layui.upload;
        var $ = layui.$;
        var layer = layui.layer;
          form.on('submit(subAdd)', function () {
           $.ajax({
               url: "AddDel",
               method: "post",
               dataType: "json",
               data: {
                   Name: $("#Name").val(),
                   Tel: $("#Tel").val(),
                   Email: $("#Email").val(),
                   Cont: $("#Cont").val(),
               },
               success: function (res) {
                   if (res.success == true) {
                       layer.msg(res.msg);
                       //关闭当前窗口，并且刷新列表
                       var index = parent.layer.getFrameIndex(window.name);
                       //关闭弹窗
                       parent.layer.close(index);
                       //刷新父页面
                       parent.location.reload();
                   } else {
                       layer.msg(res.msg);
                   }
               }
           })
       })

    })
</script>
</html>

